1. Field
The present invention relates to an image processing apparatus processing a digital image and a storage medium storing an image processing program.
2. Description of the Related Art
Recently, there is proposed a technique of region segmentation of an image obtained with an imaging apparatus such as a digital camera into a region to be a foreground (hereinafter, a foreground region) such as a main subject and a region to be a background (hereinafter, a background region). This region segmentation is executed by, for example, setting a target image as an image made up of plural regions, generating a neighbor graph indicating a relation among the plural regions, and thereafter repeating judgment on whether to integrate adjacent fundamental regions or not by evaluating each edge in the neighbor graph (see Japanese Unexamined Patent Application Publication No. 2008-059081).
When photographing is performed using the above-described imaging apparatus under a backlit condition or in a dark environment, an image in which a shadow is generated in a part of the face of a subject may be obtained. When the above-described technique of region segmentation is used for such an image, even for regions such that both adjacent regions are skin for example, if either of the regions is a region to be a shadow, these regions are segmented without being integrated. That is, when the region segmentation is performed on an image in which a shadow is generated in a part of the face of a subject, the region corresponding to the shadow becomes the background region and the other regions are segmented as the foreground region.